package com.basswold.nasaesa.client;
/**
 * Module that allows four other modules to be connected to it. Acts as a 
 * "plain" module used for walkways/etc that other modules are connected onto.
 * @author Keith
 *
 */
public class ConstructionConnectorModule extends ConstructionModule {
	
	/**
	 * Connections to modules in each cardinal direction.
	 */
	private ConstructionModule northConnection;
	private ConstructionModule eastConnection;
	private ConstructionModule southConnection;
	private ConstructionModule westConnection;
	
	/**
	 * Constructor.
	 * @param id Identification number of module.
	 */
	public ConstructionConnectorModule(final int id, final String cond, final String orient) {
		super(id, cond, orient);
		
		northConnection = null;
		eastConnection = null;
		southConnection = null;
		westConnection = null;
	}
	
	/**
	 * Reset the four connections to null.
	 */
	public void resetConnections() {
		northConnection = null;
		eastConnection = null;
		southConnection = null;
		westConnection = null;
	}
	
	/**
	 * Tell this module what other module is connected to it on its north side.
	 * @param mod The other module that is connected to this module.
	 */
	public final void setNorthConnection(final ConstructionModule mod) {
		northConnection = mod;
	}
	
	/**
	 * Tell this module what other module is connected to it on its east side.
	 * @param mod The other module that is connected to this module.
	 */
	public final void setEastConnection(final ConstructionModule mod) {
		eastConnection = mod;
	}
	
	/**
	 * Tell this module what other module is connected to it on its south side.
	 * @param mod The other module that is connected to this module.
	 */
	public final void setSouthConnection(final ConstructionModule mod) {
		southConnection = mod;
	}
	
	/**
	 * Tell this module what other module is connected to it on its west side.
	 * @param mod The other module that is connected to this module.
	 */
	public final void setWestConnection(final ConstructionModule mod) {
		westConnection = mod;
	}
	
	/**
	 * Tell if this module is already connected to another module on its
	 * north side.
	 * @return True if it is already connected, false if not.
	 */
	public final boolean hasNorthConnection() {
		return (northConnection != null);
	}
	
	/**
	 * Tell if this module is already connected to another module on its
	 * east side.
	 * @return True if it is already connected, false if not.
	 */
	public final boolean hasEastConnection() {
		return (eastConnection != null);
	}
	
	/**
	 * Tell if this module is already connected to another module on its
	 * south side.
	 * @return True if it is already connected, false if not.
	 */
	public final boolean hasSouthConnection() {
		return (southConnection != null);
	}
	
	/**
	 * Tell if this module is already connected to another module on its
	 * west side.
	 * @return True if it is already connected, false if not.
	 */
	public final boolean hasWestConnection() {
		return (westConnection != null);
	}
	
	/**
	 * Get the module connected on the north side of this module.
	 * @return The module connected to the north side of this module,
	 * 		or null if there is not one.
	 */
	public ConstructionModule getNorthModule() {
		return northConnection;
	}
	
	/**
	 * Get the module connected on the east side of this module.
	 * @return The module connected to the east side of this module,
	 * 		or null if there is not one.
	 */
	public ConstructionModule getEastModule() {
		return eastConnection;
	}
	
	/**
	 * Get the module connected on the south side of this module.
	 * @return The module connected to the south side of this module,
	 * 		or null if there is not one.
	 */
	public ConstructionModule getSouthModule() {
		return southConnection;
	}
	
	/**
	 * Get the module connected on the west side of this module.
	 * @return The module connected to the west side of this module,
	 * 		or null if there is not one.
	 */
	public ConstructionModule getWestModule() {
		return westConnection;
	}

}
